package cn.yj.netty.support.test.protocol;

import cn.yj.netty.support.test.enums.BodyType;
import cn.yj.netty.common.Const;
import cn.yj.netty.support.test.enums.EnCodeType;
import cn.yj.netty.common.Encrypt;

import java.io.Serializable;

/**
 * @author 永健
 * @since 2022-02-15 12:27
 */
public class Header implements Serializable {

    /**
     * 固定值：校验端口是我们系统正常调用，防止攻击那种
     */
    private String tag = Const.TAG;

    /**
     * 版本号
     */
    private String version;

    /**
     * 消息类型
     */
    private String messageType;

    /**
     * 会话id
     */
    private String sessionId;


    /**
     * 是否加密
     */
    private String encrypt = Encrypt.NO.getCode();

    /**
     * 编码格式：UTF-8，GBK
     */
    private String encode = EnCodeType.UTF8.name();

    /**
     * 请求时间
     */
    private Long timestamp;


    /**
     * 主机ip
     */
    private String host;

    /**
     * 指令code
     */
    private String commandCode;

    /**
     * 请求体内容
     */
    private String bodyType = BodyType.JSON_STRING.name();

    public String getTag() {
        return tag;
    }

    public Header setTag(String tag) {
        this.tag = tag;
        return this;
    }

    public String getVersion() {
        return version;
    }

    public Header setVersion(String version) {
        this.version = version;
        return this;
    }

    public String getMessageType() {
        return messageType;
    }

    public Header setMessageType(String messageType) {
        this.messageType = messageType;
        return this;
    }

    public String getSessionId() {
        return sessionId;
    }

    public Header setSessionId(String sessionId) {
        this.sessionId = sessionId;
        return this;
    }

    public String getEncrypt() {
        return encrypt;
    }

    public Header setEncrypt(String encrypt) {
        this.encrypt = encrypt;
        return this;
    }

    public String getEncode() {
        return encode;
    }

    public Header setEncode(String encode) {
        this.encode = encode;
        return this;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public Header setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
        return this;
    }

    public String getHost() {
        return host;
    }

    public Header setHost(String host) {
        this.host = host;
        return this;
    }

    public String getCommandCode() {
        return commandCode;
    }

    public Header setCommandCode(String commandCode) {
        this.commandCode = commandCode;
        return this;
    }

    public String getBodyType() {
        return bodyType;
    }

    public Header setBodyType(String bodyType) {
        this.bodyType = bodyType;
        return this;
    }
}
